.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\"
.\"     @(#)pkg.8
.\"
.Dd May 27, 2018
.Dt PKG-CLEAN 8
.Os
.Sh NAME
.Nm "pkg clean"
.Nd clean the local cache of fetched remote packages
.Sh SYNOPSIS
.Nm
.Op Fl anqy
.Pp
.Nm
.Op Fl -{all,dry-run,quiet,yes}
.Sh DESCRIPTION
.Nm
is used to cleanup the local cache of packages downloaded from remote
repositories.
It removes packages that have been superseded by newer versions, and
any packages that are no longer provided.
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width F1
.It Fl a , Fl -all
Delete all cached packages including those, which have not been superseded by
newer versions yet and are still in use.
.It Fl n , Fl -dry-run
Do not delete any package files from the cache, but show what
would be done instead.
Forces the preview of the packages that would be deleted to be shown,
even when used with
.Fl y .
Note: the package cache file permissions only permit root access.
Results will be disappointing for any other user.
.It Fl q , Fl -quiet
Be quiet.
Suppress most output.
All output is suppressed if
.Fl y
is also used.
.It Fl y , Fl -yes
Assume a yes answer instead of asking for confirmation before deleting
any out of date or redundant packages from the cache.
.El
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm .
See
.Xr pkg.conf 5
for further description.
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It Ev DEFAULT_ALWAYS_YES
.It Ev ASSUME_ALWAYS_YES
.It Ev PKG_DBDIR
.It Ev PKG_CONFIG_CACHEDIR
.El
.Sh FILES
See
.Xr pkg.conf 5 .
.Sh SEE ALSO
.Xr pkg_printf 3 ,
.Xr pkg_repos 3 ,
.Xr pkg-repository 5 ,
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-add 8 ,
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-fetch 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-lock 8 ,
.Xr pkg-query 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-rquery 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-ssh 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8
